import axios from 'axios'
const root = process;
console.log(root);

export function httpReq(method,url,params={},data={}) {
  return new Promise((resolve,reject) => {
    axios({
      method:method,
      url:url,
      params:params,
      data:data,
      headers: {
        'spreadType': 'CASH_LOAN'
      },
    }).then((res)=>{
      res=res.data;
      if(res.code===200){
        resolve(res.data);
      }else {
        reject(res.msg)
      }
    }).catch((err)=>{
      reject('异常：'+err)
    })
  })
}
